package com.cloudbroker.bcs.platform.dav.middle.task;

import java.util.Set;

import org.springframework.stereotype.Component;

import com.cloudbroker.bcs.platform.dav.common.constant.CacheKeys;
import com.cloudbroker.bcs.platform.dav.common.util.CacheHelper;
import com.cloudbroker.bcs.platform.dav.middle.task.base.SimpleLeaderTakeTask;

@Component
public class StockMarketUpdateTask extends SimpleLeaderTakeTask {
    
    @Override
    public void doTask() {
        CacheHelper cacheHelper = CacheHelper.getInstance();
        Set<String> upMarket = cacheHelper.smembers(CacheKeys.UP_MARKET);
        Set<String> downMarket = cacheHelper.smembers(CacheKeys.DOWN_MARKET);
        for (String s : upMarket) {
            cacheHelper.destroy(s);
        }
        for (String s : downMarket) {
            cacheHelper.destroy(s);
        }
        cacheHelper.destroy(CacheKeys.UP_MARKET);
        cacheHelper.destroy(CacheKeys.DOWN_MARKET);
    }
    
}
